<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../css/aui.2.0.css" />
</head>

<body>
    <header class="aui-bar aui-bar-nav main-header">
        <a class="aui-pull-left aui-btn" tapmode onclick="closeWin();">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title" id="title">
            容器物料转移
        </div>
    </header>
    <script id="chkBillTemp" type="text/x-dot-template">

        {{~ it:value:index}}
        <li class="aui-list-item" ">
            <div class="aui-media-list-item-inner">
                <div class="aui-list-item-inner ">
                    <div class="aui-list-item-text">
                        <div class="aui-list-item-title aui-font-size-14">
                            物料编码：{{= it[index].mrlCode }}
                        </div>
                    </div>
                    <div class="aui-list-item-title aui-font-size-14">
                        物料名称：{{= it[index].mrlName }}
                    </div>
                    <div class="aui-list-item-title aui-font-size-14">
                        批次号：{{= it[index].ext05 }}
                    </div>
                    <div class="aui-list-item-title aui-font-size-14">
                        数量：{{= it[index].qty }}
                    </div>
                   
                </div>
            </div>
        </li>
        {{~}}

    </script>
    <div class="aui-bar aui-bar-nav sub-header"></div>
    <div class="aui-content aui-margin-b-15" style="margin-top:50px;padding-bottom: 50px;">
        <div class="white_background">
            <ul class="aui-list aui-form-list">
                <li class="aui-list-item">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-label">原容器</div>
                        <input type="text" class="aui-input" placeholder="请扫描容器" style="width: 80%;" id="trayyinfoid"
                            onclick="getIdSelector();" onfocus="focusFn(this)">

                    </div>
                </li>
            </ul>

            <div style="background-color:white; height: 100%;width: 100%;margin-top:2%;" id="tbodyHtml">
                <div class='aaui-btn-info aui-btn-block'
                    style='margin-bottom: 10px;color: black !important;background-color: #addbef !important;height: 200px;padding: 0.2rem 0.2rem;font-size: 15px;border-radius: 8px;'>
                    <table style='width:100%;'>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>供应商：</td>
                        </tr>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>物料编码：</td>
                        </tr>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>规&nbsp&nbsp&nbsp&nbsp格：</td>
                        </tr>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>物料名称：</td>
                        </tr>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>批次号：</td>
                        </tr>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>序列号：</td>
                        </tr>
                        <tr style='width:100%;'>
                            <td style='width:50%;'>当前数量：</td>
                            <td style='width:50%;'>转移数量：<input id='" + bindQtyID + "' style='width:40%;'
                                    value='0'></input></td>
                        </tr>

                    </table>
                </div>
            </div>
        </div>
        <div class="white_background">

            <ul class="aui-list aui-form-list">
                <li class="aui-list-item">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-label">目标容器</div>
                        <input type="text" class="aui-input" placeholder="请扫描容器" style="width: 80%;"
                            id="trayyinfotargetid" onclick="getIdSelector();" onfocus="focusFn(this)">

                    </div>
                </li>
            </ul>

            <div style="background-color:white; height: 100%;width: 100%;margin-top:2%;" id="tbodyHtmlTarget">
                <div class='aaui-btn-info aui-btn-block'
                    style='margin-bottom: 10px;color: black !important;background-color: #addbef !important;height: 200px;padding: 0.2rem 0.2rem;font-size: 15px;border-radius: 8px;'>
                    <table style='width:100%;'>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>供应商：</td>
                        </tr>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>物料编码：</td>
                        </tr>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>规&nbsp&nbsp&nbsp&nbsp格：</td>
                        </tr>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>物料名称：</td>
                        </tr>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>批次号：</td>
                        </tr>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>序列号：</td>
                        </tr>
                        <tr style='width:100%;'>
                            <td style='width:100%;' colspan='2'>当前数量：</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <div class="aui-btn aui-btn-info aui-btn-block" onclick="save()" id="submitButton">提交</div>
    </div>

    <footer class="aui-bar aui-bar-tab" id="footer">
        <div class="aui-bar-tab-item" tapmode id="scan" onclick="doScan()">
            <i class="aui-iconfont aui-icon-scan aui-text-epblue" style="font-size: 1.8rem"></i>
        </div>
    </footer>

</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script type="text/javascript" src="../script/public.js"></script>
<script type="text/javascript" src="../script/clickThrottle.js"></script>
<script type="text/javascript">
    var scanRule = ""; //箱码解析规则
    var bindList = "";//物料数据列表

    //初始化查询仓库下拉框
    apiready = function () {

        $("#trayyinfoid").focus();

        //查询箱码解析规则
        initScanRule();
    }

    // 获取光标所在组件的id
    function getIdSelector() {
        var e = event || window.event;
        var el = e.srcElement || e.target;
        idSelector = el.id;
        $("#" + el.id).select();
    }

    //查询扫描规则
    function initScanRule() {
        var serverUrl = localStorage.getItem('serverUrl');
        var un = localStorage.getItem("un");
        var url = serverUrl + "/app/getTmScanRule";
        var data = {
            values: {
                un: un
            }
        };
        api.ajax({
            url: url,
            method: 'post',
            dataType: 'json',
            timeout: 300,
            returnAll: false,
            data: data
        }, function (ret, err) {
            if (ret) {
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");
                if (myobj.code == '0') {
                    scanRule = myobj.scanRule
                } else {
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }
            }
        });
    }
    //扫描
    function doScan() {
        var moduleScanner = api.require('moduleScanner');
        var params = {
            top: 150, //扫描窗口的上边距
            width: 250, //扫描窗口的宽
            height: 250, //扫描窗口的高
            useColor: false, //是否使用自己设定的颜色(startColor和endColor),
            //如果不使用设定的颜色就使用默认的那张网格图
            startColor: '#0F08C8FF', //渐变起始颜色
            endColor: '#7F08C8FF', //渐变结束颜色
            animTime: 2200, //扫描动画时间,单位为毫秒
        };
        moduleScanner.toScannerActivityForResult(params, function (ret, err) {
            //alert(ret);扫码的结果都是编码
            //1：原容器条码
            if (idSelector == 'trayyinfoid') {

                $("#trayyinfoid").val(ret);

                getTrayInfo();
                //2:箱码
            } else if (idSelector == 'tm') {

                $("#tm").val(ret);
                //查询库位
                tmSplit(ret);

                // 目标容器
            } else if (idSelector == 'trayyinfotargetid') {

                $("#trayyinfotargetid").val(ret);

                getTargetTrayInfo();

            }
        });
    }

    //绑定
    function save() {
        if (!clickThrottle()) {
            return;
        }
        var trayyinfoid = $("#trayyinfoid").val();
        var trayyinfotargetid = $("#trayyinfotargetid").val();
        const submitButton = document.getElementById('submitButton');

        submitButton.style.pointerEvents = "none"
        //原容器
        if (trayyinfoid == "" || trayyinfoid == null || trayyinfoid == undefined) {
            api.toast({
                msg: '请扫描原容器！',
                duration: 3000
            });
            submitButton.style.pointerEvents = "auto"
            return;
        }

        //目标容器
        if (trayyinfotargetid == "" || trayyinfotargetid == null || trayyinfotargetid == undefined) {
            api.toast({
                msg: '请扫描目标容器！',
                duration: 3000
            });
            submitButton.style.pointerEvents = "auto"
            return;
        }

        console.log('bindList:' + JSON.stringify(bindList));
        api.showProgress({
            title: '保存中...',
        });
        var un = localStorage.getItem("un");
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/commitContainerMrl";
        var data = {
            values: {
                oriContainerTm: trayyinfoid, //原容器条码
                targetContainerTm: trayyinfotargetid, //目标容器条码
                transferMrlList: bindList,
                un: un
            }
        };
        api.ajax({
            url: url,
            method: 'post',
            dataType: 'json',
            timeout: 300,
            returnAll: false,
            data: data
        }, function (ret, err) {
            if (ret) {
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");
                if (myobj.code == '0') {
                    api.hideProgress();
                    submitButton.style.pointerEvents = "auto"
                    api.toast({
                        msg: "提交成功",
                        duration: 3000
                    });

                    getTrayInfo();
                    getTargetTrayInfo();

                    //光标回到目标容器条码
                    $("#trayyinfotargetid").focus();
                    $("#trayyinfotargetid").select();
                    idSelector = "trayyinfotargetid";
                } else {
                    api.hideProgress();
                    submitButton.style.pointerEvents = "auto"
                    $("#trayyinfotargetid").val("");
                    $("#trayyinfotargetid").select();
                    idSelector = "trayyinfotargetid";
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }
            } else {
                api.hideProgress();
                submitButton.style.pointerEvents = "auto"
                $("#trayyinfotargetid").val("");
                $("#trayyinfotargetid").select();
                idSelector = "trayyinfotargetid";
                api.hideProgress();
                // alert(JSON.stringify(err));
                alert("连接超时，请耐心等待");
            }
        });
    }

    //自动保存
    function saveAuto() {
        var trayyinfoid = $("#trayyinfoid").val();
        var tm = $("#tm").val();
        /* var supplierCode = $("#supplierCode").val();
        var mrlCode = $("#mrlCode").val();
        var lotCode = $("#lotCode").val();
        var qty = $("#qty").val();
        var boxnum = $("#boxnum").val(); */

        //容器
        if (trayyinfoid == "" || trayyinfoid == null || trayyinfoid == undefined) {
            return;
        }

        //箱码
        if (tm == "" || tm == null || tm == undefined) {
            return;
        }
        //物料号非空校验
        // if (mrlCode == "" || mrlCode == null || mrlCode == undefined) {
        //     return;
        // }
        // //批次号非空校验
        // if (lotCode == "" || lotCode == null || lotCode == undefined) {
        //     return;
        // }

        // //数量非空校验
        // if (qty == "" || qty == null || qty == undefined || parseFloat(qty) <= 0) {
        //     return;
        // }

        // //箱号非空校验
        // if (boxnum == "" || boxnum == null || boxnum == undefined) {
        //     return;
        // }

        save();
    }

    //原容器监听回车事件
    $("#trayyinfoid").on('keypress', function (e) {
        var keycode = e.keyCode;
        var tm = $(this).val();
        if (keycode == '13') {
            if (tm != null && tm != "" && tm != undefined) {
                console.log(tm);
                $("#trayyinfoid").val(tm);
                $("#trayyinfoid").focus();
                $("#trayyinfoid").select();
                getTrayInfo();
            }

        }
    });
    //目标容器监听回车事件
    $("#trayyinfotargetid").on('keypress', function (e) {
        var keycode = e.keyCode;
        var tm = $(this).val();
        if (keycode == '13') {
            if (tm != null && tm != "" && tm != undefined) {
                console.log(tm);
                $("#trayyinfotargetid").val(tm);
                $("#trayyinfotargetid").focus();
                $("#trayyinfotargetid").select();
                getTargetTrayInfo();
            }

        }
    });

    //扫码查询返回物料信息
    function getTrayInfo() {
        var sm = $("#trayyinfoid").val();
        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/doSearchContainerMrl";
        var data = {
            values: {
                sm: sm,
                un: un
            }
        };
        api.ajax({
            url: url,
            method: 'post',
            dataType: 'json',
            timeout: 300,
            returnAll: false,
            data: data
        }, function (ret, err) {
            if (ret) {
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");

                //返回成功
                if (myobj.code == "0") {
                    var list = eval(myobj.list);

                    bindList = list;
                    var html = "";
                    var bindQtyID = "";
                    if (list.length > 0) {
                        for (var i = 0; i < list.length; i++) {
                            bindQtyID = "bindQty_" + i
                            html += "<div class='aaui-btn-info aui-btn-block' style='margin-bottom: 10px;color: black !important;background-color: #addbef !important;height: 200px;padding: 0.2rem 0.2rem;font-size: 15px;border-radius: 8px;'>";
                            html += "<table style='width:100%;'>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>供应商：" + list[i].ext11 + "</td></tr>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>物料编码：" + list[i].mrlCode + "</td></tr>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>规&nbsp&nbsp&nbsp&nbsp格：" + list[i].drawing + "</td></tr>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>物料名称：" + list[i].mrlName + "</td></tr>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>批次号：" + list[i].ext05 + "</td></tr>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'><strong>序列号：" + list[i].serialNum + "</strong></td></tr>";
                            html += "<tr style='width:100%;'><td style='width:50%;'>当前数量：" + list[i].qty + "</td><td style='width:50%;'>转移数量：<input id='" + bindQtyID + "' min='0'  style='width:40%;' value='" + list[i].transferQty + "' onblur='saveBindQyt(\"" + list[i].ext11 + "\",\"" + list[i].mrlCode + "\",\"" + list[i].ext05 + "\",\"" + list[i].qty + "\")' ></input></td></tr> ";
                            html += "</table></div>";
                        }
                    } else {
                        html += "<div class='aaui-btn-info aui-btn-block' style='margin-bottom: 10px;color: black !important;background-color: #addbef !important;height: 200px;padding: 0.2rem 0.2rem;font-size: 15px;border-radius: 8px;'>";
                        html += "<table style='width:100%;'>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>供应商：</td></tr>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>物料编码：</td></tr>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>规&nbsp&nbsp&nbsp&nbsp格：</td></tr>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>物料名称：</td></tr>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>批次号：</td></tr>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'><strong>序列号：</strong></td></tr>";
                        html += "<tr style='width:100%;'><td style='width:50%;'>当前数量：</td><td style='width:50%;'>转移数量：<input style='width:40%;' ></input></td></tr>";
                        html += "</table></div>";
                    }
                    $api.html($api.byId("tbodyHtml"), html);

                    // 光标所在位置
                    // $("#traynum").focus();
                    // idSelector = "traynum";

                    /*  var html = "";
                     for (var i = 0; i < list.length; i++) {
                         html += "<tr style='text-align: center;color: black;font-size: 10px;background-color: #F5F5F5;'>";
                         html += "<td name='mrlCode'>" + list[i].mrlCode + "</td>";
                         html += "<td name='mrlName'>" + list[i].mrlName + "</td>";
                         html += "<td name='ext05'>" + list[i].ext05 + "</td>";
                         html += "<td name='qty'>" + list[i].qty + "</td>";
                         html += "</tr>";
                     }
                     $api.html($api.byId("tbodyHtml"), html); */

                    // 两种方式 都试试
                    // var evaluation = doT.template($api.dom('#chkBillTemp').innerHTML);
                    // $api.dom('#mrlList').innerHTML = evaluation(list);

                    //失败
                } else if (myobj.code == "1") {
                    $("#trayyinfoid").val("");
                    $("#trayyinfoid").select();
                    idSelector = "trayyinfoid";

                    //清空表格数据
                    // $api.html($api.byId("tbodyHtml"), "");
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }
            } else {
                $("#trayyinfoid").val("");
                $("#trayyinfoid").select();
                idSelector = "trayyinfoid";
                api.hideProgress();
                // alert(JSON.stringify(err));
                alert("连接超时，请耐心等待");
            }
        });
    }

    //目标容器扫码查询返回物料信息
    function getTargetTrayInfo() {
        var sm = $("#trayyinfotargetid").val();
        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/doSearchTargetContainerMrl";
        var data = {
            values: {
                sm: sm,
                un: un
            }
        };
        api.ajax({
            url: url,
            method: 'post',
            dataType: 'json',
            timeout: 300,
            returnAll: false,
            data: data
        }, function (ret, err) {
            if (ret) {
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");
                var html = "";

                //返回成功
                if (myobj.code == "0") {
                    var list = eval(myobj.list);

                    if (list.length > 0) {
                        for (var i = 0; i < list.length; i++) {
                            html += "<div class='aaui-btn-info aui-btn-block' style='margin-bottom: 10px;color: black !important;background-color: #addbef !important;height: 200px;padding: 0.2rem 0.2rem;font-size: 15px;border-radius: 8px;'>";
                            html += "<table style='width:100%;'>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>供应商：" + list[i].ext11 + "</td></tr>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>物料编码：" + list[i].mrlCode + "</td></tr>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>规&nbsp&nbsp&nbsp&nbsp格：" + list[i].drawing + "</td></tr>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>物料名称：" + list[i].mrlName + "</td></tr>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>批次号：" + list[i].ext05 + "</td></tr>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'><strong>序列号：" + list[i].serialNum + "</strong></td></tr>";
                            html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>当前数量：" + list[i].qty + "</td></tr> ";
                            html += "</table></div>";
                        }
                    } else {
                        html += "<div class='aaui-btn-info aui-btn-block' style='margin-bottom: 10px;color: black !important;background-color: #addbef !important;height: 200px;padding: 0.2rem 0.2rem;font-size: 15px;border-radius: 8px;'>";
                        html += "<table style='width:100%;'>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>供应商：</td></tr>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>物料编码：</td></tr>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>规&nbsp&nbsp&nbsp&nbsp格：</td></tr>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>物料名称：</td></tr>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>批次号：</td></tr>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'><strong>序列号：</strong></td></tr>";
                        html += "<tr style='width:100%;'><td style='width:100%;' colspan='2'>当前数量：</td></tr> ";
                        html += "</table></div>";
                    }

                    $api.html($api.byId("tbodyHtmlTarget"), html);

                    // 光标所在位置
                    // $("#traynum").focus();
                    // idSelector = "traynum";

                    /*  var html = "";
                     for (var i = 0; i < list.length; i++) {
                         html += "<tr style='text-align: center;color: black;font-size: 10px;background-color: #F5F5F5;'>";
                         html += "<td name='mrlCode'>" + list[i].mrlCode + "</td>";
                         html += "<td name='mrlName'>" + list[i].mrlName + "</td>";
                         html += "<td name='ext05'>" + list[i].ext05 + "</td>";
                         html += "<td name='qty'>" + list[i].qty + "</td>";
                         html += "</tr>";
                     }
                     $api.html($api.byId("tbodyHtml"), html); */

                    // 两种方式 都试试
                    // var evaluation = doT.template($api.dom('#chkBillTemp').innerHTML);
                    // $api.dom('#mrlList').innerHTML = evaluation(list);

                    //失败
                } else if (myobj.code == "1") {
                    $("#trayyinfotargetid").val("");
                    $("#trayyinfotargetid").select();
                    idSelector = "trayyinfotargetid";

                    //清空表格数据
                    // $api.html($api.byId("tbodyHtml"), "");
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }
            } else {
                $("#trayyinfotargetid").val("");
                $("#trayyinfotargetid").select();
                idSelector = "trayyinfotargetid";

                api.hideProgress();
                // alert(JSON.stringify(err));
                alert("连接超时，请耐心等待");
            }
        });
    }

    //扫描之后箱码解析
    function tmSplit(sm) {
        $("#tm").val(sm);
        //直接解析
        if (scanRule == "old") {

            //本地解析
            localAnalyze(sm);

        } else {

            //后台解析
            postAnalyze(sm);
        }
    }

    //本地解析
    function localAnalyze(sm) {
        var arr = sm.split(",");
        $("#supplierCode").val(arr[0]);
        $("#mrlCode").val(arr[1]);
        $("#qty").val(arr[2]);
        $("#lotCode").val(arr[3]);
        $("#tmID").val(arr[4]);
        $("#boxnum").val(arr[9]);
        //箱号选中
        $("#tm").select();

        //自动保存
        saveAuto();
    }

    //后台解析箱码
    function postAnalyze(sm) {
        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/analysisBarCodeCommon";
        var data = {
            values: {
                tm: sm, //箱码
                un: un
            }
        };
        api.ajax({
            url: url,
            method: 'post',
            dataType: 'json',
            timeout: 300,
            returnAll: false,
            data: data
        }, function (ret, err) {
            if (ret) {
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");
                //成功
                if (myobj.code == '0') {

                    var map = myobj.data;
                    for (var key in map) {
                        $("#" + key).val(map[key]);
                    }

                    //自动保存
                    saveAuto();
                } else if (myobj.code == '1') {

                    $("#tm").val("");
                    $("#tm").select();
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }
            } else {
                // alert(JSON.stringify(err));
                alert("连接超时，请耐心等待");
            }
        });
    }

    //返回按钮
    function closeWin() {
        api.closeWin({});
    }
    function focusFn(ele) {
        $api.attr(ele, 'readonly', 'readonly');
        setTimeout(() => {
            $api.removeAttr(ele, 'readonly');
        }, 200);
    };

    //转移数量验证
    function saveBindQyt(ysupplier, mrlCode, lotCode, qyt) {

        console.log('当前数量' + qyt)
        for (var i = 0; i < bindList.length; i++) {

            var ss = document.getElementById('bindQty_' + i).value;
            console.log('数量' + ss)
            if (mrlCode === bindList[i].mrlCode && lotCode === bindList[i].ext05 && ysupplier === bindList[i].ext11) {
                bindList[i].transferQty = ss;
                console.log('转移数量：' + bindList[i].transferQty)

                if (parseFloat(ss) > parseFloat(qyt)) {
                    api.toast({
                        msg: '转移数量不能大于当前数量！',
                        duration: 3000
                    });
                    return;
                } else if (parseFloat(ss) < 0) {
                    api.toast({
                        msg: '转移数量不能小于0！',
                        duration: 3000
                    });
                    return;
                }


            }

        }

    }
</script>

</html>